package threads;

public class MyThread extends Thread{
	private volatile int ticket;
	
	public MyThread() {
		super();
	}
	public MyThread(int ticket){
		super();
		this.ticket=ticket;
	}

	public void run(){
		for (int i=0;i<10;i++)
		{
			if(ticket > 0){
				System.out.println("ticket = " + ticket--);
			}
		}
	}
}
